//
//  MainViewController.swift
//  weibo
//
//  Created by apple on 16/1/12.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
      addChildViewControllers()
        let mainTabBar = MainTabBar()
        setValue(mainTabBar, forKey: "TabBar")
        mainTabBar.plusBtn.addTarget(self, action: "didPlusBtnClick", forControlEvents: .TouchUpInside)
           }
   private func addChildViewControllers(){
        
   addChildViewController(HomeViewController(), imageName: "tabbar_home", title: "首页")
   addChildViewController(MessageViewController(), imageName: "tabbar_message_center", title: "消息")
   addChildViewController(DiscoveryViewController(), imageName: "tabbar_discover", title: "发现")
   addChildViewController(MeViewController(), imageName: "tabbar_profile", title: "我")
    }

    
    private func addChildViewController(vc:UIViewController,imageName:String,title:String){
        
    vc.tabBarItem.image = UIImage(named: imageName)
        
    self.tabBar.tintColor = UIColor.orangeColor()
        
        vc.title = title
        
        let nav = UINavigationController(rootViewController: vc)
    
    addChildViewController(nav)
    
    }
    @objc private func didPlusBtnClick(){
    
    
    
    }
}
